*** Replication file for main tables and figures for HRRW *** 

* NOTE: Run this globals code first
  
* NOTE: The simulated dataset might not have sufficient observations for certain
*       tables.    

********************************************************************************
********** Globals **********
********************************************************************************


* Esttab options 
global general label replace se b(%9.3fc) star(* 0.10 ** 0.05 *** .01) ///
	nonotes nogaps fragment  nomtitles

global labels "coeflabel(1.select "$\mathbbm{1}$(Award)" 1.select#1.open "$\mathbbm{1}$(Award) $\times$ $\mathbbm{1}$(Open Topic)" employees_at_app "Employees" age "Age" 1.topic0 "Hardware" 1.select#c.number_of_proposals "$\mathbbm{1}$(Award) $\times$ # Proposals" 1.select#1.num_prop_p50 "$\mathbbm{1}$(Award) $\times$ $\mathbbm{1}$($>$ P50 # Proposals)" 1.ever_open "$\mathbbm{1}$(Ever Applied Open)" 1.select#1.ever_open "$\mathbbm{1}$(Award) $\times$ $\mathbbm{1}$(Ever Applied Open)" 1.high_emp "$\mathbbm{1}$(High Emp)" 1.over_medage "$\mathbbm{1}$(High Age)" 1.open#c.employees_at_app "$\mathbbm{1}$(Open Topic) $\times$ Employees" 1.open#c.age "$\mathbbm{1}$(Open Topic) $\times$ Age" 1.high_emp#1.open "$\mathbbm{1}$(High Emp) $\times$ $\mathbbm{1}$(Open Topic)" 1.over_medage#1.open "$\mathbbm{1}$(High Age) $\times$ $\mathbbm{1}$(Open Topic)" 1.select#1.non_specific "$\mathbbm{1}$(Award) $\times$ $\mathbbm{1}$ ($>$ P66 Non-specificity)") "
	

* Regression specifications
global rddmain_controls "c.rank_v2_win##open c.rank_v2_lose##open c.total_score_norm"
global open_first "open==1 & phase==1 & firm_first_open_proposal==1"
global conv17_first "open==0 & phase==1 & firm_first_conv_proposal==1 & year > 2016"
global open_all "open==1 & phase==1"
global conv_all "open==0 & phase==1"

* Folders
global dir "replication"
global data "$dir/data/clean"
global figures "$dir/figures"
global tables "$dir/tables"

********************************************************************************
********** Tables and Figures **********
********************************************************************************

do "$dir/code/table1.do"
do "$dir/code/table2.do"
do "$dir/code/table3.do"
do "$dir/code/table4.do"
do "$dir/code/table5.do"
do "$dir/code/table6.do"
do "$dir/code/table7.do"

do "$dir/code/figure1.do"
do "$dir/code/figure2.do"
do "$dir/code/figure3.do"
do "$dir/code/figure4.do"
do "$dir/code/figure5.do"
do "$dir/code/figure6.do"
do "$dir/code/figure7.do"

